<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父子组件</title>
</head>

<body>
    <div id="app">
        <father-name></father-name>

    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        const son = Vue.extend({
            template: `<h2>我是son组件</h2>`
        });
        const father = Vue.extend({
            template: `
            <div>
            <h2>我是father组件</h2>
            <son-name></son-name>
            <son-name></son-name>
            <son-name></son-name>
            ========================
            </div>
            `,
            components: {
                "son-name": son
            }

        });
        Vue.component("father-name", father)
        var app = new Vue({
            el: '#app',
            data: {
                message: 'Hello Vue!'
            },
            components: {
                "father-name": father
            }
        })
    </script>
</body>

</html>